#include <OgreMeshManager.h>
#include <OgrePrerequisites.h>
#include <exceptionhandling.h>

#define DLL_EXPORT __declspec(dllexport)

using namespace Ogre;

extern "C" DLL_EXPORT MeshManager *getMeshManager()
{
	return new MeshManager();
}

extern "C" DLL_EXPORT MeshManager *call_MeshManager_getSingletonPtr()
{
	return MeshManager::getSingletonPtr();
}

extern "C" DLL_EXPORT MeshPtr *call_createPlane(MeshManager *ptr, const char *name, const char *groupName, Plane *plane,
													float width, float height, int xsegments, int ysegments, bool normals,
													unsigned short numTexCoordSets, float uTile, float vTile, Vector3 *upVector,
													HardwareBuffer::Usage vertexBufferUsage, HardwareBuffer::Usage indexBufferUsage,
													bool vertexShadowBuffer, bool indexShadowBuffer)
{
	try{
		return &(ptr->createPlane(name, groupName, *plane, width, height, xsegments, ysegments, normals, numTexCoordSets, uTile, vTile,
								*upVector, vertexBufferUsage, indexBufferUsage, vertexShadowBuffer, indexShadowBuffer));
	}catch(const Ogre::Exception& e){
		call_ehandler((Ogre::Exception*)&e);
		return NULL;
	}
}